
var Info = {

	popup: function (e, p2, id) {
		$.cookie('id_', id);

		p2 = query(p2);
		$.cookie('p2', p2);
		
		var a1 = ['编辑跟单', 'url', 'Info.dialog_edit_', '600x400', '编辑跟单信息'];
		var a2 = ['查看跟单', 'url', 'Common.dialog_view_', '600x400', '查看跟单信息'];

		var c1 = 'customer.php?do=Info.edit&id=' + id;
		var c2 = 'customer.php?do=Info.view&id=' + id;

		var s = c1 + ", " + c2;

		return popup(e, [a1, a2], s);
	},

	dialog_edit_: function (url, title, xy) {
		$.getJSON('mold.php?do=Info.ajax_emp', function(json) {
			if (json.status == 1) {
				$('#dialog_edit').dialog('option', 'buttons', {

					"关闭": function() {
						$(this).dialog("close");
					},

					"修改": function() {
						if (!confirm("确认是否提交？")) {
							return false;
						}

						var form = $("#form_edit")[0];

						var body = {};
						body.id = form.id.value;
						body.title = form.title.value;
						body.content = form.content.value;

						$(this).dialog("close");

						var url = 'customer.php?do=Info.editPost';
						var p2 = $.cookie('p2');
						if (p2 != null) {
							url += p2;
						}

						$.post(url, body, function(data) {
							$('#result').html(data);
						});
					}
				});

				dialog_edit(url, title, xy);
			} else {
				_error();
			}
		});
	}
};
